<?php

/**
 * MatchType form base class.
 *
 * @method MatchType getObject() Returns the current form's model object
 *
 * @package    symfony
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMatchTypeForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'coefficient' => new sfWidgetFormInputText(),
      'title'       => new sfWidgetFormInputText(),
      'type'        => new sfWidgetFormChoice(array('choices' => array('team' => 'team', 'individual' => 'individual'))),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'coefficient' => new sfValidatorNumber(array('required' => false)),
      'title'       => new sfValidatorString(array('max_length' => 65)),
      'type'        => new sfValidatorChoice(array('choices' => array(0 => 'team', 1 => 'individual'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('match_type[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'MatchType';
  }

}
